<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <blockquote class="layui-elem-quote">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input class="layui-input searchval" type="text" placeholder="请输入搜索的内容">
                    </div>
                    <button class="layui-btn" id="search_btn" data-type="reload">搜索</button>
                </div>
            </blockquote>
            <table class="layui-hide" id="equipmentTable" lay-filter="equipmentTables"></table>
            <div id="laypage"></div>
        </div>
    </div>
</div>
<input type="hidden" id="curnum" value="1">
<%--<script type="text/html" id="equipmentOperation">--%>
<%--    <shiro:hasPermission name="instrument:equipment:add">--%>
<%--        <div class="layui-inline" lay-event="add" title="添加">--%>
<%--            <i class="layui-icon layui-icon-add-1"></i>--%>
<%--        </div>--%>
<%--    </shiro:hasPermission>--%>
<%--</script>--%>
<script type="text/html" id="table-equipment">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="info">详情</a>
    <shiro:hasPermission name="instrument:equipment:overyears">
        <a class="layui-btn layui-btn-checked layui-btn-xs" lay-event="overyears"></i>仪器检定</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="instrument:equipment:update">
        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="update"></i>修改</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="instrument:equipment:del">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </shiro:hasPermission>
</script>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['table', 'equipment', 'layer', 'form'], function () {
        var $ = layui.jquery,
            table = layui.table,
            layer = layui.layer,
            form = layui.form;

        //搜索事件
        var active = {
            reload: function () {  //data-type='reload'
                var searchval = $('.searchval').val();
                $("#curnum").val("1");
                table.reload('equipmentTable', { //表格的id
                    where: {
                        key: searchval,
                        page: 1,
                        limit: 10,
                    },
                    text: {
                        none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                    }
                })
            }
        };

        $('#search_btn').on('click', function () { //搜索的id
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

<%--        table.on('toolbar(equipmentTables)', function (obj) {--%>
<%--            var checkStatus = table.checkStatus(obj.config.id)--%>
<%--                , data = checkStatus.data, //获取选中的数据--%>
<%--                newsId = [];--%>
<%--            switch (obj.event) {--%>
<%--                case 'add':--%>
<%--                    var clocess = "1";--%>
<%--                    var index = layer.open({--%>
<%--                        title: "添加",--%>
<%--                        type: 2,--%>
<%--                        content: '<%=request.getContextPath()%>/rest/getRoute?type=instrument&url=equipment_add',--%>
<%--                        maxmin: true,--%>
<%--                        area: ['90%', '91%'],--%>
<%--                        //是否显示右上角关闭图标，默认为1，显示--%>
<%--                        anim: 4,--%>
<%--                        shade: 0.6,--%>
<%--                        skin: 'layui-layer-molv',--%>
<%--                        resize: true,--%>
<%--                        cancel: function (index, layero) {--%>
<%--                            layer.close(index)--%>
<%--                            clocess = "2"--%>
<%--                            return false;--%>
<%--                        },--%>
<%--                        success: function (layero, index) {  //当你需要在层创建完毕时即执行一些语句，可以通过该回调 想相当于吧值转到子界面--%>

<%--                        },--%>
<%--                        end: function () {--%>
<%--                            if (clocess == "2") {--%>

<%--                            } else {--%>
<%--                                table.reload('equipmentTable')--%>
<%--                            }--%>
<%--                            return false;--%>
<%--                        }--%>
<%--                    });--%>
<%--//                    $('.layui-layer-setwin .layui-layer-max').css("display", "none")--%>
<%--//                    $('.layui-layer-setwin .layui-layer-min').css("display", "none")--%>
<%--                    break;--%>
<%--            }--%>
<%--            ;--%>
<%--        });--%>


    });
</script>
</body>
</html>
